<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2017/11/30
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<div class="mui-card">
  <div class="mui-card-header">
    客户登记
    <button type="button" id="btn_add_customerInfo" class="mui-btn mui-btn-primary" ${isStart}>新建客户信息表</button>
  </div>
  <div id="page-content" class="mui-col-sm-12 mui-col-xs-12">
    <div class="table-jqgrid">
      <table id="customerInfo_table"></table>
      <div id="customerInfo_page"></div>
    </div>
  </div>
  <div class="mui-card-footer">页脚</div>
</div>



<script>

  $(function(){

    init_grid_customerInfo();

  });

  function init_grid_customerInfo() {
        __init_jqgrid('customerInfo_table', 'customerInfo_page',
                '<%=path%>/mp/customerInfo/list?viewtype=${viewtype}',
                ['客户名称','所在区域',"操作","id"],
                [
                  {name:'name',index:'name', width:100,search:false,sortable:true, searchoptions: {sopt: ['cn']}},
                  {name:'area',index:'area', width:100,search:false,sortable:true, searchoptions: {sopt: ['cn']}},
                  {name:'act',index:'act', width:60,sortable:false,search:false,fixed:true,formatter: actFormat},
                  {name:'id',index:'id',search:false,hidden:true}
                ],
                true,true
        );
  }

  function actFormat(cellvalue, options, rowObject){
    var id = rowObject.id;
    cellvalue = '<button type="button" class="mui-btn" onclick="fn_customerInfo_read(\'' + id + '\');">查看</button>';

    return cellvalue;
  }

  function fn_customerInfo_read(id) {
    loadURL('<%=path%>/mp/customerInfo/read?keyId='+id+'&viewtype=${viewtype}', $('#page-content'));
  }

  $("#btn_add_customerInfo").click(function(){
    loadURL('<%=path%>/mp/customerInfo/input', $('#page-content'));
  });
</script>